﻿@namespace MudBlazor.Docs.Examples

<MudCard>
    <MudCardHeader>
        <CardHeaderContent>
            <MudText Typo="Typo.body1">Istra Croatia</MudText>
            <MudText Typo="Typo.body2">Peninsula in Europe</MudText>
        </CardHeaderContent>
    </MudCardHeader>
    <div @onclick="@(OpenContextMenu)" @oncontextmenu="@(OpenContextMenu)" @oncontextmenu:preventDefault @oncontextmenu:stopPropagation>
        <MudCardMedia Image="images/pilars.jpg" Height="250"/>
    </div>
    <MudCardContent>
        <MudText Typo="Typo.body2">Try left clicking or right clicking the image to open the menu.</MudText>
    </MudCardContent>
</MudCard>

<MudMenu PositionAtCursor @ref="_contextMenu">
    <MudMenuItem Label="Undo" />
    <MudMenuItem Label="Redo" Disabled />
    <MudDivider />
    <MudMenuItem Label="Cut" />
    <MudMenuItem Label="Copy" />
    <MudMenuItem Label="Paste" />
</MudMenu>

@code {
#nullable enable
    private MudMenu _contextMenu = null!;

    private async Task OpenContextMenu(MouseEventArgs args)
    {
        await _contextMenu.OpenMenuAsync(args);
    }
}
